package io.renren.modules.PCguanli.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.PCguanli.entity.ScoreRpEntity;
import io.renren.modules.PCguanli.service.ScoreRpService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 驻厂人员成绩
 *
 * @author zhangdanxiaozu
 * @email dan.zhang@zju.edu.cn
 * @date 2024-03-19 14:11:47
 */
@RestController
@RequestMapping("PCguanli/scorerp")
public class ScoreRpController {
    @Autowired
    private ScoreRpService scoreRpService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("PCguanli:scorerp:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = scoreRpService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{scoreNumber}")
    @RequiresPermissions("PCguanli:scorerp:info")
    public R info(@PathVariable("scoreNumber") Integer scoreNumber){
		ScoreRpEntity scoreRp = scoreRpService.getById(scoreNumber);

        return R.ok().put("scoreRp", scoreRp);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("PCguanli:scorerp:save")
    public R save(@RequestBody ScoreRpEntity scoreRp){
		scoreRpService.save(scoreRp);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("PCguanli:scorerp:update")
    public R update(@RequestBody ScoreRpEntity scoreRp){
		scoreRpService.updateById(scoreRp);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("PCguanli:scorerp:delete")
    public R delete(@RequestBody Integer[] scoreNumbers){
		scoreRpService.removeByIds(Arrays.asList(scoreNumbers));

        return R.ok();
    }

}
